package zero.tech.games.gate.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import zero.tech.core.data.Resp;
import zero.tech.core.data.SimpleUser;
import zero.tech.games.gate.service.api.IExtService;

@RestController
public class ExtController extends BaseController{
	@Autowired
	private IExtService extService;
	@RequestMapping("/list-marquee")
	public Resp listMarquee(HttpServletRequest request,@RequestBody Map<String,Object> map) {
		SimpleUser simpleUser=super.getLoginUser(request);
		return extService.listMarquee(simpleUser);
	}
	
	
	@RequestMapping(value = "/mail-list")
	public Resp mailList(HttpServletRequest request,@RequestBody Map<String, Object> params){
		SimpleUser simpleUser=super.getLoginUser(request);
		Integer page = Integer.valueOf(params.get("page").toString());
		Integer pageLength = Integer.valueOf(params.get("pageLength").toString());
		return extService.mailList(simpleUser, page, pageLength);
	}

	@RequestMapping(value = "/mail-read")
	public Resp mailRead(HttpServletRequest request, @RequestBody Map<String, Object> params){
		SimpleUser simpleUser=super.getLoginUser(request);
		Integer mail_id = Integer.valueOf(params.get("mail_id").toString());
		return extService.mailRead(simpleUser, mail_id);
	}

	@RequestMapping(value = "/mail-del")
	public Resp mailDel(HttpServletRequest request, @RequestBody Map<String, Object> params)  {
		SimpleUser simpleUser=super.getLoginUser(request);
		Integer mail_id = Integer.valueOf(params.get("mail_id").toString());
		return extService.mailDel(simpleUser, mail_id);
	}
}
